package com.ekalenchuk.module.domain.bet;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ekalenchuk.module.domain.user.Group;
import com.ekalenchuk.module.domain.user.User;
import com.ekalenchuk.module.enums.ParticipantTypeEnum;

@Entity
@Table(name="participant")
public class Participant implements Serializable {
	private static final long serialVersionUID = -2483623028683398525L;
	
	private Long id;
	private User user;
	private Group group;
	private ParticipantTypeEnum type;
	
	private Bet bet;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne()
	@JoinColumn(name="user_id")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne
	@JoinColumn(name="group_id")
	public Group getGroup() {
		return group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	@Column(name="type")
	@Enumerated(EnumType.ORDINAL)
	public ParticipantTypeEnum getType() {
		return type;
	}

	public void setType(ParticipantTypeEnum type) {
		this.type = type;
	}

	@ManyToOne()
	@JoinColumn(name="bet_id")
	public Bet getBet() {
		return bet;
	}

	public void setBet(Bet bet) {
		this.bet = bet;
	}
	
}
